package network.tpa1;

import signals.*;

public class SignalConversion {

	public enum SignalType {
		ACCEPT_FILE,
		HELLO,
		HELLO_REPLY,
		GOOD_BYE,
		ASK_LOGIN,
		PROP_FILE,
		SEND_TEXT
	} ;
	
	/**
	 * Return the type of signal corresponding to s. Return null if s is null.
	 * 
	 * @param s
	 * @return
	 */
	public static SignalType getSignalType (Signal s) {
		if (s instanceof Hello) {
			return SignalType.HELLO ;
		}
		else if (s instanceof HelloReply) {
			return SignalType.HELLO_REPLY ;
		}
		else if (s instanceof GoodBye) {
			return SignalType.GOOD_BYE ;
		}
		else if (s instanceof AskLogin) {
			return SignalType.ASK_LOGIN ;
		}
		else if (s instanceof PropFile) {
			return SignalType.PROP_FILE ;
		}
		else if (s instanceof SendText) {
			return SignalType.SEND_TEXT ;
		}
		else if (s instanceof AcceptFile) {
			return SignalType.ACCEPT_FILE ;
		}
		return null;
	}
	
}
